home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / FLOODFIL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  941 b   |  37 lines

  1.  
  2.                                         /* File       : floodfil.c */
  3.                                         /* Entered by : A. Wayner */
  4. # include <graphics.h>
  5. # include <stdlib.h>
  6.  
  7.  
  8. main()
  9. {
  10.     int graphdriver = DETECT, graphmode;
  11.  
  12.                                             /* Detect adapter type and initialize */
  13.                                             /* graphics system */
  14.     initgraph( &graphdriver, &graphmode, "\\turboc" );
  15.     outtextxy( 10, 10, "Demonstrating floodfill");
  16.  
  17.                                             /* First draw a rectangle with a white */
  18.                                             /* border and a solid fill style */
  19.     setlinestyle( USERBIT_LINE, 0xffff, THICK_WIDTH );
  20.     setcolor( WHITE );
  21.     rectangle( 0, 50, 100, 100 );
  22.  
  23.                                             /* Now use floodfill to fill the interior */
  24.                                             /* with red */
  25.     setfillstyle( SOLID_FILL, LIGHTCYAN );
  26.     floodfill( 25, 75, WHITE );
  27.     outtextxy( 10, 20, grapherrormsg( graphresult() ));
  28.  
  29.                                             /* Wait until user presses a key */
  30.     outtextxy( 10, getmaxy() - 30, "Press any key to exit");
  31.  
  32.     getch();
  33.     closegraph();
  34. }
  35.  
  36.  
  37.